define(function (require, exports, module) {
    var $ = require('jquery');
    var _ = require('underscore');
    var ajaxOptions = {
        cache: false,
        dataType: 'json',
        timeout: 5000
    };
    var urlBase = 'http://www.suge123.com/json/';

    var AjaxManager = {};

    AjaxManager._init = function () {
        var doc = $(document);

        if (!window._isAjaxInitialized) {
            window._isAjaxInitialized = true;
        }

        doc.ajaxError(function (event, XMLHttpRequest, ajaxOptions, thrownError) {
        });

        $.ajaxPrefilter(function (options, originalOptions, jqXHR) {
        });
    };

    AjaxManager.send = function (target, data, onSuccess) {
        $.ajax($.extend(ajaxOptions, {
            url: urlBase + target + '.htm',
            data: data,
            success: onSuccess
        }));
    };

    AjaxManager._init();

    exports.AjaxManager = AjaxManager;
});